package com.jjmo.edu.info.manger.service;

import com.jjmo.edu.info.manger.dao.StudentDao;
import com.jjmo.edu.info.manger.domain.Student;

public class StudentService {
    public boolean addStudent(Student student) {
        StudentDao studentDao = new StudentDao();
        boolean result = studentDao.addStudent(student);


        return result;
    }

    public boolean isExists(String id) {
        StudentDao studentDao = new StudentDao();
        Student[] stus = studentDao.findAllStudent();
        boolean exists = false;
        for (int i = 0; i < stus.length; i++) {
            Student student = stus[i];
            if (student != null && student.getId().equals(id)) {
                exists = true;
                break;
            }
        }
        return exists;
    }
}
